//========================================================================================
//  
//  $File: //depot/indesign_7.x/highprofile/source/open/includes/interactive/ColorizedIcon.h $
//  
//  Owner: Tim Wright
//  
//  $Author: alokumar $
//  
//  $DateTime: 2011/04/01 11:22:15 $
//  
//  $Revision: #1 $
//  
//  $Change: 781912 $
//  
//  Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
//  
//  NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance 
//  with the terms of the Adobe license agreement accompanying it.  If you have received
//  this file from a source other than Adobe, then your use, modification, or 
//  distribution of it requires the prior written permission of Adobe.
//  
//  
//  Helper for form frame adorment...
//  
//========================================================================================

#pragma once
#ifndef __COLORIZEDICON__
#define __COLORIZEDICON__

//----------------------------------------------------------------------------------------
#include "BravoForwardDecl.h"
#include "IColorData.h"
#include "PMRect.h"

class PlatformIcon;

#pragma export on

class ColorizedIcon
{
public:
	WIDGET_DECL ColorizedIcon( const PMRsrcID& inRsrcID );
 	WIDGET_DECL virtual ~ColorizedIcon();
	
	WIDGET_DECL ErrorCode Draw( IGraphicsPort * inGraphicsPort, const PMPoint& inIconTopLeft, const ColorArray& inColor );
	WIDGET_DECL PMRect GetBounds() const;
	WIDGET_DECL PMRect GetNonTransparentBounds(const ColorArray& inColor);
	WIDGET_DECL void UseOriginalAlpha(bool16 useIt=kTrue);

protected:

	ErrorCode GenerateImage(const ColorArray& inColor, bool16 inCheckColor=kTrue);
	void Dispose();
	void DisposeImage();
	void GetImage(AGMImageRecord* outAGMRecord) const;
	ErrorCode ImageIcon();
	ErrorCode Colorize( const ColorArray& inColor );

private:
	PlatformIcon * fIcon;
	uint8* fImagePixelStorage;
	int32 fImageRowBytes;
	int32 fImageWidth;
	int32 fImageHeight;
	bool fHaveIconImage;
	mutable bool fHaveNonTransparentBounds;
	mutable PMRect fNonTransparentBounds;
	ColorArray fImagedColor;
	bool16 fUseOriginalAlpha;
};

#pragma export off

#endif

